import type { PageParam, PageResult } from '@vben/request';

import { requestClient } from '#/api/request';

export namespace TeamInfoApi {
  /** 团队信息 */
  export interface TeamInfo {
    id?: number;
    // TODO: 添加字段
  }

  /** 团队信息分页查询参数 */
  export interface TeamInfoPageReqVO extends PageParam {
    createTime?: string[];
    // TODO: 添加查询条件字段
  }
}

/** 查询团队信息分页 */
export function getTeamInfoPage(params: TeamInfoApi.TeamInfoPageReqVO) {
  return requestClient.get<PageResult<TeamInfoApi.TeamInfo>>(
    '/cmt/team-info/page',
    { params },
  );
}

/** 查询团队信息详情 */
export function getTeamInfo(id: number) {
  return requestClient.get<TeamInfoApi.TeamInfo>(
    `/cmt/team-info/get?id=${id}`,
  );
}

/** 新增团队信息 */
export function createTeamInfo(data: TeamInfoApi.TeamInfo) {
  return requestClient.post('/cmt/team-info/create', data);
}

/** 修改团队信息 */
export function updateTeamInfo(data: TeamInfoApi.TeamInfo) {
  return requestClient.put('/cmt/team-info/update', data);
}

/** 删除团队信息 */
export function deleteTeamInfo(id: number) {
  return requestClient.delete(`/cmt/team-info/delete?id=${id}`);
}

/** 批量删除团队信息 */
export function deleteTeamInfoList(ids: number[]) {
  return requestClient.delete(
    `/cmt/team-info/delete-list?ids=${ids.join(',')}`,
  );
}

/** 导出团队信息 */
export function exportTeamInfo(params: any) {
  return requestClient.download('/cmt/team-info/export-excel', { params });
}

/** 获取团队信息选项列表(用于下拉选择) */
export function getTeamInfoOptions() {
  return requestClient.get<PageResult<TeamInfoApi.TeamInfo>>(
    '/cmt/team-info/page',
    { params: { pageNo: -1, pageSize: 10 } },
  );
}
